package com.mew.user.controller;


import com.mew.common.dc.mapper.GameIdMapper;
import com.mew.common.entity.user.GameId;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class GidController {

    @Autowired
    private GameIdMapper gameIdMapper;


    @GetMapping("/gid/{start}/{number}")
    @ResponseBody
    public Integer gid(@PathVariable("start") int start, @PathVariable("number") int number){
        try {
            for (int i = start; i < start + number; i++) {
                GameId gameId = new GameId();
                gameId.setGid(Integer.toString(i));
                gameIdMapper.insert(gameId);
            }
            return 1;
        }catch (Exception e){
            e.printStackTrace();
            return 1;
        }

    }

}
